Skip to content

[PULP-2416] Stream proxied S3 and Azure artifacts - #8364

Merged
dralley merged 6 commits into
pulp:mainfrom
dralley:streaming-fix-backup
Dec 4, 2026
Merged

dralley merged 6 commits into
pulp:mainfrom
dralley:streaming-fix-backup

Conversation

@dralley

@dralley dralley commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

Avoid unnecessary buffering of large files by taking advantage of a streaming API in forked django-storages.

closes #7806

📜 Checklist

  • Commits are cleanly separated with meaningful messages (simple features and bug fixes should be squashed to one commit)
  • A changelog entry or entries has been added for any significant changes
  • Follows the Pulp policy on AI Usage
  • (For new features) - User documentation and test coverage has been added

See: Pull Request Walkthrough

@dralley dralley closed this Nov 20, 2026
@dralley dralley reopened this Nov 20, 2026
@dralley
dralley force-pushed the streaming-fix-backup branch 4 times, most recently from 06d090a to 68994ae Compare November 25, 2026 06:29
@dralley
dralley marked this pull request as ready for review November 25, 2026 06:29
@dralley
dralley requested a review from mdellweg November 25, 2026 06:30
@dralley dralley changed the title [PULP-2416] Stream proxied S3 and Azure artifacts [DO NOT MERGE][PULP-2416] Stream proxied S3 and Azure artifacts Nov 25, 2026
@dralley
dralley marked this pull request as draft November 25, 2026 06:34
@dralley

dralley commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

I'll leave this as draft just to make sure nobody merges it.

@dralley dralley changed the title [DO NOT MERGE][PULP-2416] Stream proxied S3 and Azure artifacts [PULP-2416] Stream proxied S3 and Azure artifacts Nov 25, 2026
@dralley
dralley force-pushed the streaming-fix-backup branch 2 times, most recently from 2afcda8 to 679196c Compare November 25, 2026 16:43
@dralley
dralley marked this pull request as ready for review December 1, 2026 03:57
@dralley
dralley force-pushed the streaming-fix-backup branch from 679196c to 92c46a0 Compare December 1, 2026 04:03
Serve proxied artifacts without buffering the remote files. django-storages
buffers files to provide a seekable interface, but this is unnecessary
for the streaming use case.

Keep synchronous storage I/O off the content application event loop.

closes pulp#7806

Assisted By: Codex (GPT-5) Terra 5.6
@dralley
dralley force-pushed the streaming-fix-backup branch from 92c46a0 to 799c348 Compare December 1, 2026 04:07
Comment thread docs/admin/reference/settings.md Outdated
as compatibility identifiers.
If your deployment overrides `DOMAIN_STORAGE_BACKENDS` or configures object storage in
`STORAGES`, update implementation paths from `storages.backends.*` to
`pulpcore.vendor.storages.backends.*` to select the bundled code.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Realistically users shouldn't be tweaking the storage backends, but we expose it, so we should probably remove this whole comment but still have a changelog entry mentioning that any overridden values ought to be changed back / left alone unless you really know what you're doing. Do you agree?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually this whole setting was just added in the last PR. Honestly it shouldn't be exposed, on second thought, and I'm just going to move that value to constants.

Comment thread docs/admin/reference/settings.md Resolved
Comment thread pulpcore/responses.py
through Pulp when object-storage redirects are disabled. Django storage
streams are synchronous, so open and close run in worker threads; reads
are dispatched there by `_sendfile()`. Preserve cleanup after errors or
early response termination.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could maybe get native async with something based on obstore

Or if we were to update the vendored django-storages for it. I think the blocker is that boto3 hasn't supported it historically but it's being worked on.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the previous implementation would have been blocking in the executor as the executor isn't natively going to throw it to a separate thread.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not directly related to the PR, but if we wanna use obstore, do you envision something like replacing django-storages or kinda being integrated in the django-storages vendored code, like as a library?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably the former. Or maybe the latter at first and then later the former.

Comment thread pyproject.toml Outdated
Comment on lines +71 to +73
s3 = ["django-storages[boto3] @ git+https://github.com/dralley/django-storages.git@open-stream"]
google = ["django-storages[google] @ git+https://github.com/dralley/django-storages.git@open-stream"]
azure = ["django-storages[azure] @ git+https://github.com/dralley/django-storages.git@open-stream"]
s3 = ["django-storages[boto3]==1.14.6"]
google = ["django-storages[google]==1.14.6"]
azure = ["django-storages[azure]==1.14.6"]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think, the result of this endeavour should be to replace the dependency on django-storages with the dependencies of the vendored code.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@dralley

dralley commented Dec 4, 2026

Copy link
Copy Markdown
Contributor Author

Made changes based on discussion with @pedro-psb. There's no need to have DOMAIN_STORAGE_BACKENDS be exposed via settings and as that was just added in the previous PR we can go ahead and remove it.

@dralley
dralley force-pushed the streaming-fix-backup branch 2 times, most recently from ccd6271 to 1dcfb63 Compare December 4, 2026 03:10
Bundle the backend source in the pulpcore distribution and retain
optional provider dependencies for S3, Azure, and GCS deployments.
Move the vendored backends under Pulp's package namespace so they cannot
collide with an independently installed django-storages package.

Update built-in backend mappings, test settings, and operator guidance to
use the new import paths while preserving legacy Domain storage_class values.

Assisted By: Codex (GPT-6)
Map the vendored compatibility path to Pulp's S3 backend so the S3
runner's configured storage passes the redirect backend check. Add
regression coverage for backend identification and validation.

Assisted By: Codex (GPT-6)
Move the implementation map out of Django settings so deployments use
STORAGES for the default backend while Pulp selects implementations for
other Domain storage IDs internally. Update resolution, tests, and admin
documentation to reflect the internal mapping.

Assisted By: Codex (GPT-6)
@dralley
dralley force-pushed the streaming-fix-backup branch from 1dcfb63 to e889eb3 Compare December 4, 2026 04:45

@mdellweg mdellweg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we are ready.

Comment thread pyproject.toml
Comment on lines -71 to +73
s3 = ["django-storages[boto3]==1.14.6"]
google = ["django-storages[google]==1.14.6"]
azure = ["django-storages[azure]==1.14.6"]
azure = ["azure-core>=1.13", "azure-storage-blob>=12"]
google = ["google-cloud-storage>=1.36.1"]
s3 = ["boto3>=1.4.4"]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@dralley
dralley merged commit cf705f9 into pulp:main Dec 4, 2026
13 checks passed
@dralley
dralley deleted the streaming-fix-backup branch December 4, 2026 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Content app OOMs serving large S3 artifacts with REDIRECT_TO_OBJECT_STORAGE=False

3 participants